"use client"

import Link from "next/link";
import { useEffect, useState } from "react";

export default () => {

  const [currentTime, setCurrentTime] = useState(new Date());

  useEffect(() => {
    const intervalId = setInterval(() => {
      setCurrentTime(new Date());
    }, 20000); 

    return () => clearInterval(intervalId);
  }, []);

  return (
    <div>
      <p>data: {currentTime.toLocaleDateString()} {currentTime.toLocaleTimeString()}</p>

      <Link href="/client/child" style={{ backgroundColor: '#00BCD4', padding: '2px 20px', borderRadius: '5px',border: '2px solid black' }}>
        Child
      </Link>
    </div>
  );
}